package kaizone.haining.chaobohui.widget;

import kaizone.haining.chaobohui.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

public class UsersComment extends LinearLayout {

	private TextView mContentView;
	private ImageButton mReplyView;

	private OnCommentClickListener mCommentClickListener;

	public UsersComment(Context context) {
		super(context);
		init();
	}

	public UsersComment(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	private void init() {

	}

	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		mContentView = (TextView) findViewById(R.id.tv01);
		mReplyView = (ImageButton) findViewById(R.id.btn);
		mReplyView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (mCommentClickListener != null) {
					mCommentClickListener.onClick(v);
				}
			}
		});
	}

	public void setContent(String text) {
		mContentView.setText(text);
	}

	public void setReply(boolean bool) {
		if (bool) {
			mReplyView.setVisibility(View.VISIBLE);
		} else {
			mReplyView.setVisibility(View.INVISIBLE);
		}
	}

	public void setOnCommentClickListener(OnCommentClickListener listener) {
		mCommentClickListener = listener;
	}

	public interface OnCommentClickListener {
		void onClick(View v);
	}

}
